<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>按需动态加载模块</title>
  </head>
  <body>
    <button>后盾人</button>
    <script type="module">
      //import命令静态顶层加载
      let btn = document.querySelector("button");
      btn.addEventListener("click", () => {
        //使用import()函数，实现动态加载
        import("./modules/houdun.js").then(({ site, url }) => {
          console.log(site, url);
        });
      });
    </script>
  </body>
</html>
